package org.sxp.common.web;

/**
 * @author shenxingping
 * @date 2021/01/29
 */
public class XpContextHolder {
    private static ThreadLocal contextHolder = new ThreadLocal();

    public XpContextHolder() {
    }

    public static void setContext(XpContext hsafContext) {
        contextHolder.set(hsafContext);
    }

    public static XpContext getContext() {
        Object obj = (XpContext)contextHolder.get();
        if (obj == null) {
            obj = new XpContextImpl();
            setContext((XpContext)((XpContext)obj));
        }

        return (XpContext)((XpContext)obj);
    }
}
